package org.example;

import org.example.entity.Image;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/images")
public class ImageController {
    @Autowired
    private ImageService imageService;

    @GetMapping("/getAll")
    public List<Image> getAll() {
        return imageService.getAll();
    }

    @GetMapping("/getOne/{id}")
    public Image getOne(@PathVariable Integer id) {
        return imageService.getOne(id);
    }

    @PostMapping("/insert")
    public Integer insert(@RequestBody Image image) {
        return imageService.insert(image);
    }
}